prezentacja

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.3     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(plotly)
## 
## Attaching package: 'plotly'
## 
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following object is masked from 'package:graphics':
## 
##     layout
library(gapminder)

funkcja ggplotly = transformacja ggplot w wykres interakwyny

w <- ggplot(mpg, aes(displ,
                     hwy)) + 
  geom_point()

standardowy wykres

w

wykres interaktywny plotly

ggplotly(w)

wykres interaktywny plotly z danymi gapmminder

wykres <- 
  ggplot(gapminder, 
         aes(y = lifeExp, 
             x = gdpPercap)) +
  geom_point()
x <- ggplotly(wykres)
x

kontrolowanie wyświetlanego tekstu

y <- ggplotly(wykres)

style(y, 
      text = gapminder$country)